﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace _9._3
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {

        }

        private void btnSort_Click(object sender, EventArgs e)
        {
            string[] str = txtNumber.Text.Split(',');
            int[] num = new int[str.Length];

            try
            {
                for (int i = 0; i < str.Length; i++)
                {
                    num[i] = Convert.ToInt32(str[i]);
                }
            }
            catch(Exception ex)
            {
                lblshow.Text += ex.Message;
            }
            Array.Sort(num);
            lblshow.Text = "排序后的序列是：";
            foreach(int n in num)
            {
                lblshow.Text += string.Format("{0} ", n);
            }
        }
    }
}
